package com.poorstu.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;

import com.common.base.web.BaseAction;
import com.poorstu.manager.StudentManager;
import com.poorstu.model.UserPartTimeMod;

public class StuApplyPtAction extends BaseAction {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		
		
		try{
		int allUserId=(Integer)request.getSession().getAttribute("allUserId");
			//int allUserId=1;
		DynaActionForm dyna=(DynaActionForm)form;
		int jobId=(Integer)dyna.get("jobId");
		UserPartTimeMod upt=new UserPartTimeMod();
		upt.setParStatus(0);
		//upt.ssetUser(allUserId);
		//upt.setPts(pts)
		StudentManager stuManager=(StudentManager)getBean("studentManager");
		stuManager.addPtApply(upt,allUserId,jobId);
		
		return mapping.findForward("succ");
		}catch(Exception e)
		{
			e.printStackTrace();
		return mapping.findForward("failure");
		}
		
	}
	
	

}
